/*
 * LoginForm.java
 * 
 * Version information
 * 
 * Mar 16, 2006
 * 
 * Copyright (c) AmSoft Systems, 2006
 */
package net.amsoft.iservice.management.webapp.struts.form;

import javax.servlet.http.HttpServletRequest;

import net.amsoft.iservice.management.util.IBrokerConstants;

import org.apache.struts.action.ActionErrors;
import org.apache.struts.action.ActionForm;
import org.apache.struts.action.ActionMapping;
import org.apache.struts.action.ActionMessage;
import org.apache.struts.action.ActionMessages;

/**
 * @author rahul
 *  
 */
public class LoginForm extends ActionForm {

    private String sSynonym;
    private String sIBroker;
    private String sService;

    public String getSynonym() {
        return sSynonym;
    }

    public void setSynonym(String synonym) {
        sSynonym = synonym;
    }

    public String getIBroker() {
        return sIBroker;
    }

    public void setIBroker(String broker) {
        sIBroker = broker;
    }

    public String getService() {
        return sService;
    }

    public void setService(String service) {
        sService = service;
    }

    public ActionErrors validate(ActionMapping mapping,
            HttpServletRequest request) {
        ActionErrors oErrors = new ActionErrors();
        if ((sSynonym==null) || (sSynonym.trim().length()<3)) {
            oErrors.add(ActionMessages.GLOBAL_MESSAGE, new ActionMessage(
                    IBrokerConstants.ERR_INAME, "synonym"));
        } else {
            sSynonym = sSynonym.trim().toLowerCase();
        }
        return oErrors;
    }
}